package com.example.customviewtouch.layout_size.view

import android.content.Context
import android.media.Image
import android.util.AttributeSet
import android.widget.ImageView
import androidx.appcompat.widget.AppCompatImageView
import com.example.customviewtouch.util.dp
import java.lang.Math.min

class SquareImageView(context: Context, attrs: AttributeSet?) : AppCompatImageView(context, attrs) {

    override fun layout(l: Int, t: Int, r: Int, b: Int) {
        val width = r - l
        val height = b - t
        val size = min(width, height)
        super.layout(l, t, l + size, t + size)
    }

}